package com.miracle.java2110.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.miracle.java2110.pojo.Employeemanager;
import com.miracle.java2110.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @author miracle
 * @date 2021/11/10 21:58
 * @Description
 */
@Component
@Scope("prototype")
public class WebEmployeeListener extends AnalysisEventListener<Employeemanager> {

    @Autowired
    EmployeeService employeeService;

    @Override
    public void invoke(Employeemanager employeemanager, AnalysisContext analysisContext) {
        System.out.println(employeemanager);
        employeeService.addEmployee(employeemanager);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
